#ifndef RAID_H_
#define RAID_H_

#include <stdio.h>
#include <stdint.h>
#include <semaphore.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <ifaddrs.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/un.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#include <time.h>
#include "fRaid.h"

#define BUFF_LIMIT 535
#define BACKLOG 10

#define HANDSHAKE '0'
#define HANDSHAKE_OK 0x23
#define CLOSE_CONECTION 0x24
#define GET_SECTOR 'L'
#define PUT_SECTOR 'E'
#define PUT_SECTOR_SINC 'S'
#define EMPTY_MSG "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

tipoDisco* listaDiscos;
tipoPedido* listaPedidos;
tipoPedido* listaPedidosLast;
tipoPedido* listaPedidosSincro;
tipoPedido* listaPedidosSincroLast;
tipoPedido* listaAtendidos;
tipoPedido* listaPUTwait;
tipoSincro* listaSincro;

int32_t sockFS;
int32_t sinPD;
int32_t sinFS;
int32_t raidFuncionando;

sem_t semPedSincro;
sem_t semPed;
pthread_mutex_t mutexPedidos;
pthread_mutex_t mutexPedidosSincro;
pthread_mutex_t mutexAtendidos;
pthread_mutex_t mutexDiscos;
pthread_mutex_t mutexSincro;
pthread_mutex_t mutexSockFS;

#endif
